<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="../js/lodash.js"></script>
    <script>
        // 指定循环次数
        _.times(5,function(i){
            console.log(i);
        });
        // map循环
        let arr = _.map([1,2,3],function(item){
            return item * item;
        });
        console.log(arr);

        // 浅拷贝
        let obj = {a:1,b:[1,2]};
        // let obj1 = _.clone(obj);
        // obj.b.push(3);
        // console.log(obj,obj1);

        // 深拷贝
        let obj2 = _.cloneDeep(obj);
        obj.b.push(3);
        console.log(obj,obj2);

        // 随机数
        console.log(_.random(5,10,true));

        // 数组去重
        console.log(_.uniq([100,200,100,500,200,100,300,400]));

        // 获取所有集合的长度
        let obj3 = {a:1,b:2,c:3};
        console.log(_.size(obj3));
    </script>
</body>
</html>